﻿using System;
using System.Collections.Generic;
using BLL.Installer;
using BLL.Interface.User;
using BLL.Model.User;
using System.Linq;

namespace BLL.Model.Base
{
    public class LoginUserInfo
    {
        public LoginUserInfo()
        {
            LoginUserId = Guid.NewGuid().ToString("N");
            LoginTime = DateTime.Now;
            LastAccessTime = DateTime.Now;
        }

        public string LoginUserId { get; set; }

        public int UserInfoId { get; set; }

        public string UserAccountName { get; set; }

        public string UserName { get; set; }

        public DateTime LoginTime { get; set; }

        public DateTime LastAccessTime { get; set; }

        public string LoginIP { get; set; }

        public IList<string> Roles { get; set; }

        public UserInfo UserInfo
        {
            get
            {
                var userInfoManager = ContainerHelper.Instance.Container.Resolve<IUserInfo>();
                return userInfoManager.FindUserInfoById(UserInfoId);
            }
        }

    }

}
